systemd unit

Home > Software Notes > File formats

reference

man pages: systemd.unit, systemd.service, systemd.timer

examples

periodic oneshot service

/etc/systemd/system/foo.service

[Unit]
Description=Foo

[Service]
Type=oneshot
ExecStart=/usr/bin/foo

/etc/systemd/system/foo.timer

[Unit]
Description=Foo

[Timer]
OnCalendar=hourly
Persistent=true

[Install]
WantedBy=timers.target

Enable timer:

systemctl daemon-reload
systemctl enable --now foo.timer